package com.haipumi.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * 获取当前时间
 * @author Administrator
 *
 */
public class GetNowTime {

	/**
	 * @param format "yyyy-MM-dd HH-mm-ss"
	 * @return
	 */
	public static String getNowTime(String format){
		SimpleDateFormat df=new SimpleDateFormat(format);
		String today=df.format(new Date());
		String[] todays=today.split("-");
		String M=todays[1];
		String d=todays[2];
		if(M.indexOf("0")==0){//把0裁掉
			M=M.substring(1);
		}
		if(d.indexOf("0")==0){
			d=d.substring(1);
		}
		return todays[0]+"-"+M+"-"+d;
	}
}
